<% 
response.setContentType("application/vnd.ms-word;charset=UTF-8");
request.setCharacterEncoding("UTF-8"); 
response.setHeader("Content-Disposition","attachment; filename=date.doc");
java.io.OutputStream myFilePath = ( java.io.OutputStream )response.getOutputStream(); 
java.io.OutputStreamWriter   resultFile=new   java.io.OutputStreamWriter(myFilePath,"UTF-8");   
java.io.PrintWriter   myFile=new   java.io.PrintWriter(resultFile); 
String   strContent   =   request.getParameter("str").toString(); 
myFile.print(strContent);   
resultFile.close();   
myFilePath.flush();
myFilePath.close();
out.clear();   
out = pageContext.pushBody();  
%>
<script>window.close();</script>